@charset "UTF-8";

// 绝对居中
@mixin absCenter {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
}

// 清除浮动
@mixin clearFloat {
	&:before,
	&:after {
		content: "";
		clear: both;
		display: block;
		height: 0;
		overflow: hidden;
	}
}

// 剪切隐藏（不影响屏幕识别）
@mixin clipHidden {
	position: absolute;
    clip: rect(0, 0, 0, 0);
}

// 纸张阴影效果
// $depth: 阴影深度（1-4，默认为1）
@mixin buildShadow($depth: 1, $color: #000) {
	$y1: 1px;
	$y2: 1px;

	$blur1: 2px;
	$blur2: 3px;

	$spread1: 0;
	$spread2: 0;

	@if $depth == 2 {
		$y2: 2px;

		$blur1: 4px;
		$blur2: 6px;
	} @else if $depth == 3 {
		$y2: 5px;

		$blur1: 6px;
		$blur2: 10px;
	} @else if $depth >= 4 {
		$y1: 2px;
		$y2: 8px;

		$blur1: 8px;
		$blur2: 20px;

		$spread1: 1px;
		$spread2: 2px;
	}

	box-shadow: 0 $y1 $blur1 $spread1 rgba($color, 0.07),
				0 $y2 $blur2 $spread2 rgba($color, 0.1);
}

// 外边距
 $margin-quantity: 5;  // 以5为最小度量
 @mixin buildAtomMargin($dire) {
	 $dire-word: top;

	 @if $dire == r {
		 $dire-word: right;
	 } @else if $dire == b {
		 $dire-word: bottom;
	 } @else if $dire == l {
		 $dire-word: left;
	 }

	 @for $i from 1 through 4 {
		 $quantity: $margin-quantity * $i;
		 $selector: $quantity;

		 @if $quantity < 10 {
			 $selector: 0#{$quantity};
		 }

		 .#{$ns-util}m#{$dire}#{$selector} {margin-#{$dire-word}: $quantity * 1px;}
	 }
 }

 // 圆角补丁（前后圆角，中间无圆角）
 @mixin buildRadius($dire, $radius) {
	border-top-#{$dire}-radius: $radius;
	border-bottom-#{$dire}-radius: $radius;
}
